<template>
	<div style="height: 400px;border: 1px solid aqua;">
		<h3>我的分数表</h3>
		<table border="1" class="ce">
			<tr><th>学生名字</th><th>手机号</th><th>班级</th><th>课程</th><th>分数</th><th>批改的时间</th></tr>
			<tr v-for="x in data.marks">
				<td>{{x.user.uname}}</td>
				<td>{{x.user.phone}}</td>
				<td>{{x.user.clz.clzname}}</td>
				<td>{{x.course.cname}}</td>
				<td>{{x.score }}</td>
				<td>{{ mydate(x.tpost)}}</td>
				</tr>
		</table>
	</div>
</template>

<script setup>
import {ref,reactive,onMounted} from 'vue'
	import {$get,$postx,$postf} from "../../ajax/index.js"
	import myalert from "../../utils/myalert.js"
	const data =reactive({
		marks:[],
	})
	/* 获取学生的分数 */
	onMounted(()=>{
		$get("/api/fore/stu/findMyMark")
		.then((reap)=>{
			myalert("获取数据完毕.."+reap.data.length)
			console.log(reap.data.data);
			data.marks=reap.data.data;
		})
	})
	/* 日期格式化 */
	const mydate=(d)=>{
		d=new Date(d);
		console.log(d)
		console.log( typeof d)
		let yy= d.getFullYear();
		let mm= d.getMonth()+1;
		let dd=d.getDate();
		let b=yy+"年"+mm+"月"+dd+"日";
		return b;
	}
</script>

<style>
	.ce{
		margin-top: auto;
		margin-right: auto;
	}
</style>
